package org.emergency.framework.dao.oa.Impl;

import org.emergency.framework.dao.HibernateBaseDao;
import org.emergency.framework.dao.oa.ITbIdsDAO;
import org.emergency.framework.model.TbIds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;


@Repository("tbIdsDAO")
public class TbIdsDAO extends HibernateBaseDao<TbIds> implements ITbIdsDAO {
	private static final Logger log = LoggerFactory.getLogger(TbIdsDAO.class);

	protected void initDao() {
		// do nothing
	}

	public TbIds findById(Integer id) {
		log.debug("getting TbIds instance with id: " + id);
		try {
			TbIds instance = (TbIds) getHibernateTemplate().get(
					"org.emergency.framework.model.TbIds", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public void attachDirty(TbIds instance) {
		log.debug("attaching dirty IdManager instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

}
